import { resetRouter, routes } from "@/router";
import { defineStore } from "pinia";
import { ref } from "vue";
import type { RouteRecordRaw } from "vue-router";

 export const useMenuStore = defineStore('menu', () => {
// pnpm的类型会报，yarn不会
const menuList = ref<RouteRecordRaw[]>([...routes])
const setMenuList = (filterRoutes:RouteRecordRaw[])=>{
  menuList.value = [...menuList.value,...filterRoutes]
}

// 重置菜单和路由
const clearMenuList = ()=>{
  menuList.value = [...routes]
resetRouter()
}


  return {menuList,setMenuList,clearMenuList}
})
